/**
 * A extention of jquery
 * To Show Tips in Inputs and Textareas when value of them is empty.
 * yuk. Feb 2010 
 */

$.fn.extend({
	smartInput:function(param){
		if(typeof param == 'string'){
			param = {text: param};
		}
		
		var $obj = this;
		
		var setVal = function(){
			if($obj.val() == ''){
				$obj.val(param.text);
				$obj.addClass('smartInputTips');
			}
		}
		
		var removeVal = function(){
			if($obj.val() == param.text){
				$obj.val('');
				$obj.removeClass('smartInputTips');
			}
			
		}
		
		setVal();// initial
		this.click(removeVal);
		this.blur(setVal);
	}
});